// FIXME

`include "code\source\P1\hamming_encoder.v"
`timescale 1ns/1ps

module tb_hamming_encoder;

// Input
reg clk = 0;
reg clk2 = 0;
reg rst_n = 0;
reg din;
reg din_valid = 0;

// Output
wire dout;
wire dout_valid;

hamming_encoder u_hamming_encoder(
                    .clk (clk ),
                    .clk2 (clk2 ),
                    .rst_n (rst_n ),
                    .din (din ),
                    .din_valid (din_valid ),
                    .dout (dout ),
                    .dout_valid (dout_valid ));

initial begin
    $dumpfile("./release/test_hamming_encoder.vcd");
    $dumpvars(0, tb_hamming_encoder);
end

initial begin
    clk <= 0;
    clk2 <= 1;
    rst_n <= 0;
    din_valid <= 0;
    #6
    rst_n <= 1;
    #4
    din_valid <= 1;

    din <= 0;
    #10
    din <= 1;
    #10
    din <= 0;
    #10
    din <= 1;
    #10

    din <= 1;
    #10
    din <= 0;
    #10
    din <= 0;
    #10
    din <= 1;
    #10

    din_valid <= 0;
    #100;
    $finish;
end

always begin
    #2.5
    clk2 <= ~clk2;
    #2.5
    clk2 <= ~clk2;
    clk <= ~clk;
end

endmodule
